<template>
  <div class="srbd">
    <div class="bd">
      <div class="cesaun_container">
        <h3 class="title">
          <p class="line">在线摇卦</p>
        </h3>
        <div>
          <div style="text-align: center">
            <p style="padding: 20px">
              卜卦方法：静默一分钟，心念集中于你所测之事，如爱情、事业、健康等，然后心念一动，点击立即摇卦，掷出金钱卦，并查看卦辞，请自行体会其中的吉凶指示。
            </p>
            <div style="display: flex; gap: 10px; justify-content: center">
              <img
                src="@/assets/image/jinqian.gif"
                style="width: 83px; height: 87px"
                alt=""
              />
              <img
                src="@/assets/image/jinqian.gif"
                style="width: 83px; height: 87px"
                alt=""
              />
              <img
                src="@/assets/image/jinqian.gif"
                style="width: 83px; height: 87px"
                alt=""
              />
              <img
                src="@/assets/image/jinqian.gif"
                style="width: 83px; height: 87px"
                alt=""
              />
              <img
                src="@/assets/image/jinqian.gif"
                style="width: 83px; height: 87px"
                alt=""
              />
              <img
                src="@/assets/image/jinqian.gif"
                style="width: 83px; height: 87px"
                alt=""
              />
            </div>

            <p style="padding: 20px">
              什么是金钱卦：金钱卦是六爻占卜中的简易算法，即双掌合住六枚铜钱摇而掷出成卦。什么时候停止摇卦，全凭自己心念之所至，易经摇卦，贵在随机而动，占卜方能感应所求。
            </p>
          </div>
        </div>
        <div style="text-align: center">
          <el-button type="primary" @click="submitForm" style="margin: 20px"
            >测算</el-button
          >
        </div>

        <!-- 主体表单 -->
      </div>
      <div>
        <h3 class="title">
          <p class="line">测算简介</p>
        </h3>
        <div style="font-size: 14px; margin: 0 10px 20px 10px">
          <p style="">
            1.六十四卦金钱课，就是用三枚铜钱占卦，每掷出三枚铜钱一次，即得到一爻，掷六次，得到六爻，排成卦象，即得到六十四卦之一，用以占卜吉凶。后世亦传有简易的金钱课占法，只需掷出一次铜钱即可，缘份居金钱课卜卦即本于此。
          </p>
          <p>2.心诚则灵，测算结果仅供参考。</p>
        </div>
      </div>
    </div>
    <el-dialog
      title="测算结果"
      :visible.sync="centerDialogVisible"
      width="50%"
      class="dialog_cesuan"
    >
      <div class="bazi_info" v-if="result != null">
        <div class="base_info">
          <div class="show">
            <span class="l">您抽出妈祖灵签第 {{ result.id }} 签:</span>
            <span class="r">{{ result.number }}</span>
          </div>
          <div class="show">
            <span class="l">卦名:</span>
            <span class="r">{{ result.common_desc1 }}</span>
          </div>
          <div class="show">
            <span class="l">象曰:</span>
            <span class="r">{{ result.common_desc2 }}</span>
          </div>
          <div class="show">
            <span class="l">解卦:</span>
            <span class="r">{{ result.common_desc3 }}</span>
          </div>
        </div>
        <div style="text-align: center">
          <img :src="result.image" alt="" />
        </div>

        <div class="base_info">
          <div class="details">
            <div class="names">
              <span>事业:</span>
            </div>
            <div class="des">
              <span class="des_deta">{{ result.shiye }}</span>
            </div>
          </div>
          <div class="details">
            <div class="names">
              <span>经商：</span>
            </div>
            <div class="des">
              <span class="des_deta">{{ result.jingshang }}</span>
            </div>
          </div>

          <div class="details">
            <div class="names">
              <span>求名:</span>
            </div>
            <div class="des">
              <span class="des_deta">{{ result.qiuming }}</span>
            </div>
          </div>
          <div class="details">
            <div class="names">
              <span>外出:</span>
            </div>
            <div class="des">
              <span class="des_deta">{{ result.waichu }}</span>
            </div>
          </div>
          <div class="details">
            <div class="names">
              <span>婚恋:</span>
            </div>
            <div class="des">
              <span class="des_deta">{{ result.hunlian }}</span>
            </div>
          </div>
          <div class="details">
            <div class="names">
              <span>决策:</span>
            </div>
            <div class="des">
              <span class="des_deta">{{ result.juece }}</span>
            </div>
          </div>
        </div>
        <div class="yl">
          <span>仅供娱乐！请勿当真</span>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  computed: {
    currentPath() {
      return this.$route.path; // 获取当前路由路径
    },
  },
  data() {
    return {
      centerDialogVisible: false,
      birthday: "",

      result: {
        id: 21, //您掷出易经第 21 卦
        common_desc1: "火雷噬嗑（噬嗑卦） 刚柔相济 上上卦", //卦名
        common_desc2:
          "运拙如同身受饥，幸得送饭又送食，适口充腹心欢喜，忧愁从此渐消移。", //象曰
        common_desc3:
          "异卦（下震上离）相叠。离为阴卦；震为阳卦。阴阳相交，咬碎硬物，喻恩威并施，宽严结合，刚柔相济。噬嗑（shihe）为上下颚咬合，咀嚼。", //解卦
        shiye:
          "困难与阻力非常大，应以坚强的意志，果敢的行为，公正无私的态度去战胜种种厄运，争取事态好转。为了早日化险为夷，必要时可采取强硬手段，甚至诉诸法律。", //事业
        jingshang:
          "处于不利的时候，头脑冷静，明察形势，寻求机遇，不为眼前小利所诱，不发非分之财。认真听取忠告，遵守法纪，秉公办事，不得徇私情，更警惕不得触犯刑律。", //经商
        qiuming:
          "自己的努力尚不为人所知，不可急于求成，受到挫折应看作是对自己的考验，持之以恒，必能成功。", //求名
        waichu: "另择他日为佳。若非出门不可，务必充分准备，小心为是。", //外出
        hunlian:
          "初不顺利，须有顽强精神可以取得满意的结果，不可以个的情绪左右家庭事务。", //婚恋
        juece:
          "一生不平坦，会遇到挫折和磨难，但应看作是对个人的考验，应认真总结经验教训，以更为坚强的意志，不屈不挠，继续前进。经过锻炼，各方面都会有较大的进展，终将进入光明境地，取得重大成就。", //决策
        image: "https://yuanfenju.com/Public/img/zhouyi64gua/21.jpg", //卦图
      },
      area: "",
      form: {
        shuzi: "",
      },
    };
  },
  mounted() {},
  methods: {
    submitForm() {
      this.form["api_key"] = "FNcQHQuf0W8wDrXMjWc0xqTzw";
      let config = {
        headers: {
          "Content-Type": "application/x-www-form-urlencoded",
        },
      };
      this.$axios
        .post(window.config.apiUrl + "/v1/Zhanbu/yaogua", this.form, config)
        .then((res) => {
          if (res.data.errcode == -1) {
            this.$message({
              type: "warning",
              message: res.data.errmsg,
            });

            return;
          }

          this.centerDialogVisible = true;
          this.result = res.data.data;
          console.log(this.result);
        });
    },
  },
};
</script>

<style scoped lang="scss">
.bd {
  border: 1px solid #e5e5e5;
}

.cesaun_container {
}

::v-deep .el-card.is-always-shadow {
  box-shadow: none !important;
}

::v-deep .el-card__header {
  padding: 10px 20px !important;
}

.form-card {
  width: 100%;
  margin: 0 auto;
  border-radius: 2px;
}

.form-title {
  margin: 0;
  color: #303133;
  font-size: 16px;
  text-align: left;
}

.el-form-item {
  margin-bottom: 22px;
}

.el-radio {
  margin-right: 30px;
}

::v-deep .distpicker-address-wrapper {
  width: 100% !important;
}

@mixin flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  height: 45px;
}

@mixin tr1_w {
  width: 33px;
  text-align: center;
}

.dialog_cesuan {
  .bazi_info {
    height: 85vh;
    overflow-y: auto;
    padding: 20px;
    background-color: #fff;

    .base_info {
      margin: 20px;

      .title {
        display: flex;
        padding: 5px;

        .shu {
          width: 5px;
          height: 20px;
          background-color: #e6a84b;
          border-radius: 10px;
        }

        .ti {
          padding-left: 8px;
          font-weight: 800;
          font-size: 15px;
        }
      }

      .show {
        margin-top: 15px;

        .l_ {
          font-size: 14px;
          display: inline-block;
          min-width: 50px;
          font-weight: 800;
        }

        .l {
          font-size: 15px;
          display: inline-block;
          min-width: 50px;
          font-weight: 800;
        }
      }

      .details {
        border: 1px solid #e5e5e5;
        border-bottom: none;
        margin-top: 20px;

        .names {
          text-align: center;
          color: #e6a84b;
          border-bottom: 1px solid #e5e5e5;
          color: #e6a84b;
          font-weight: 800;
          background-color: #fff3ef;
          height: 50px;
          line-height: 50px;
        }

        .des {
          border-bottom: 1px solid #e5e5e5;
          padding-left: 10px;
          display: flex;
          align-items: center;

          .des_text {
            color: #e6a84b;
            width: 14%;
            font-weight: 800;
            user-select: text;
          }

          .des_deta {
            width: 85%;
            line-height: 26px;
            text-indent: 2em;
            user-select: text;
          }
        }
      }
    }
  }
}
</style>